import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/14 16:38
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String T = sc.nextLine();
            int cnt = 0;
            for (char c: T.toCharArray()) {
                if (Character.isUpperCase(c)) {
                    cnt++;
                }
            }
            System.out.println(cnt);
        }
    }
}
